#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 5e6+10;

int ans,ls;
char s[N];

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	scanf("%s",s+1); ls = strlen(s + 1);
	for(int i = 1;i <= ls;){
		int j = i,k = i + 1;
		while(k <= ls && s[j] <= s[k]){
			if(s[j] == s[k]) j++,k++;
			else if(s[j] < s[k]) j = i,k++;
		}
		while(i <= j){
			i += k - j; ans ^= i - 1;
		}
	}printf("%lld\n",ans);
	return 0;
}

